package com.aldd.service.impl;

import com.aldd.entity.Book;
import com.aldd.mapper.BookMapper;
import com.aldd.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {
    @Autowired
    private BookMapper bookMapper;

    @Override
    public List<Book> selectAllBook() {
        return bookMapper.selectAllBook();
    }

    @Override
    public Book selectBookById(int id) {
        return bookMapper.selectBookById(id);
    }

    @Override
    public Boolean deleteBookById(int id) {
        return bookMapper.deleteBookById(id) > 0;
    }

    @Override
    public Boolean insertBook(Book book) {
        return bookMapper.insertBook(book) > 0;
    }

    @Override
    public Boolean updateBook(Book book) {
        return bookMapper.updateBook(book) > 0;
    }

    @Override
    public List<Book> selectBookByBookName(String bookName) {
        return bookMapper.selectBookByBookName(bookName);
    }
}
